<style type="text/css">
  .user {
    position: relative;
  }
  .user-list {
    position: absolute;
    top: 100%;
    left: 15px;
    right: 15px;
    display: none;
    z-index: 10;
    max-height: 150px;
    overflow: auto;
    background-color: #fff;
    border: 1px solid #ccc;
  }
  .user-list li {
    padding: .4em;
    border-bottom: 1px solid #e9e9e9;
  }
  .user-list li:last-of-type {
    border-bottom: none;
  }
  .user-list li:hover {
    background-color: #eee;
  }
  .user-list .user-name {
    font-weight: 500;
  }
  .user-list .user-nickname {
    float: right;
    font-size: .8em;
  }
</style>
<form class="form-horizontal" role="form">
  <div class="form-group">
    <label class="col-sm-2 control-label">订单供货商</label>
    <div class="col-sm-10">
      <p class="form-control-static"><if condition="$order.agent_id eq 0">总商家<else/>代理商&nbsp;{$order.agentName}</if></p>
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-2 control-label">订单编号</label>
    <div class="col-sm-10">
      <p class="form-control-static">{$order.order_no}</p>
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-2 control-label">订单状态</label>
    <div class="col-sm-10">
      <p class="form-control-static">{$order.orderStatusName}</p>
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-2 control-label">收货人</label>
    <div class="col-sm-10">
      <p class="form-control-static">{$order.consignee}</p>
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-2 control-label">收货人地址</label>
    <div class="col-sm-10">
      <p class="form-control-static">{$order.provinceName} {$order.cityName} {$order.areaName} {$order.address}</p>
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-2 control-label">订单总价</label>
    <div class="col-sm-10">
      <p class="form-control-static">{$order.goods_amount}</p>
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-2 control-label">总运费</label>
    <div class="col-sm-10">
      <p class="form-control-static">{$order.shipping_fee}</p>
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-2 control-label">商品列表</label>
    <div class="col-sm-10">
      <volist name="order.items" id="vo">
      <volist name="vo.items" id="vo_product">
      <p class="form-control-static">
        <div class="panel panel-info">
          <div class="panel-heading">
            <h3 class="panel-title">商品名称：{$vo.goods_name}</h3>
          </div>
          <div class="panel-body">
            <img src="{$vo_product.goods_pic}">
            <div>商品单价：{$vo_product.goods_price}</div>
            <div>购买数量：{$vo_product.goods_number}</div>
            <div>所选属性：{$vo_product['goods_attr']?$vo_product['goods_attr']:'--'}</div>
          </div>
        </div>
      </p>
      </volist>
      </volist>
    </div>
  </div>
  <present name="order['bonusInfo']">  
  <div class="form-group">
    <label class="col-sm-2 control-label">用户分成</label>
    <div class="col-sm-10">
      <foreach name="order['bonusInfo']" item="vo" key="k">
      <div class="form-control-static" style="float:left; width:333px;">
        <div class="panel panel-info">
          <div class="panel-heading" style="display: inline-block; width: 100%;">
            <h3 class="panel-title"><img width="50" height="50" src="{$order['bonusUser'][$k]['face']}" style="float:left;margin-right:12px"/><div>用户名：{$order['bonusUser'][$k]['nickname']}</div></h3>
            <p>OpenId：{$order['bonusUser'][$k]['openId']}</p>
            <p>代理等级: {$order['bonusUser'][$k]['level']+1}</p>
          </div>
          <div class="panel-body">
            <present name="vo.bonus"><div>分销佣金：{$vo['bonus']}</div></present>
            <present name="vo.bonusRecommend"><div>培养佣金：{$vo['bonusRecommend']}</div></present>
          </div>
        </div>
      </div>
      </foreach>
    </div>
  </div>
  </present>
  
  <if condition="in_array('deliver', $order['operates'])">
  <div class="form-group">
    <label class="col-sm-2 control-label">物流方式</label>
    <div class="col-sm-3">{$order.deliverMethodRadio}</div>
  </div>
  <div class="form-group" id="div_express_name">
    <label class="col-sm-2 control-label">快递名称</label>
    <div class="col-sm-3">
     <select id="select_express_name" name="express_name" class="form-control">{$order.expressOptions}</select>
    </div>
   </div>
   <div class="form-group" id="div_shipping_no">
    <label class="col-sm-2 control-label">物流单号</label>
    <div class="col-sm-3">
     <input type="text" class="form-control" name="shipping_no" value="{$order['shipping_no']}" placeholder="请正确填写物流单号" datatype="*">
    </div>
   </div>
   <div class="form-group">
    <div class="col-sm-offset-2 col-sm-8">
      <input type="hidden" name="id" value="{$_GET['id']}">
      <button type="submit" class="btn btn-primary submit" data-loading-txt="提交中，请稍后……" data-ajax-url="__CONTROLLER__/deliverPost">确认发货</button>
    </div>
   </div>
   <script type="text/javascript">
   $(function() {
	   var deliver_config = {'0':{'panel':['#div_express_name','#div_shipping_no'], 'valid':[{'#select_express_name':'*'}, {"#div_shipping_no input[name='shipping_no']":'*'}]},};
	   $("input[name='deliver_method']").click(function() {
		   if($(this).attr('selected') != $(this).val()) {
			   for(var o in deliver_config) {
				   var c = deliver_config[o];
				   if( $(this).val()==o ) {
					   for(var panelIndex in c['panel'])
						   $(c['panel'][panelIndex]).show();
					   for(var validIndex in c['valid'])
						   for(var cc in c['valid'][validIndex])
							   $(cc).attr('datatype', c['valid'][validIndex][cc]);
				   } else {
					   for(var panelIndex in c['panel'])
						   $(c['panel'][panelIndex]).hide();
					   for(var validIndex in c['valid'])
						   for(var cc in c['valid'][validIndex])
							   $(cc).removeAttr('datatype');
				   }
			   }
			   $("input[name='deliver_method']").attr('selected', $(this).val());
		   }
	   });
	   $("input[name='deliver_method']:eq(0)").click();
   });
   </script>
   </if>
   
   <if condition="in_array('refund_apply', $order['operates'])">
   <div class="form-group">
    <div class="col-sm-offset-2 col-sm-8">
      <button type="button" class="btn btn-primary" id="btn-confirm-refund" order-id="{$_GET['id']}">同意退款</button>
    </div>
   </div>
   <script type="text/javascript">
   $(function() {
	   $("#btn-confirm-refund").click(function() {
			if ( confirm("同意他退款吗?") ) {
				var scope = this;
				$(this).attr('disabled', "disabled");
				$.post('__CONTROLLER__/confirmRefund', {id:$(this).attr("order-id")}, function( data ) {
					if ( data.error == 0 ) {
						alert(data['msg']);
					} else {
						alert(data['msg']);
					}
				});
			}
	   });
   });
   </script>
   </if>
   
   <if condition="in_array('refund_search', $order['operates'])">
   <div class="form-group">
    <div class="col-sm-offset-2 col-sm-8">
      <button type="button" class="btn btn-primary" id="btn-search-refund" order-id="{$_GET['id']}">更新退款状态</button>
    </div>
   </div>
   <script type="text/javascript">
   $(function() {
	   $("#btn-search-refund").click(function() {
			$.post("{:U('Home/DisShopPay/refundSearch')}", {
				"id":$(this).attr("order-id"), 
				"sid":"{:session('id')}",
			}, function( data ) {
				if ( data.error == 0 ) {
					alert(data['msg']);
				} else {
					alert(data['msg']);
				}
			});   
	   });
   });
   </script>
   </if>
   
</form>

<style tpye="text/css">
  img { height:50px; }
</style>